<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>

  <script>
    function newPage(pagenum) {
      return new Promise((resolve, reject) => {
        var xhr = new XMLHttpRequest()
        xhr.onreadystatechange = function () {
          if (xhr.readyState == 4) {
            if (xhr.status >= 200 && xhr.status <= 304) {
              resolve(xhr.response)
              //   var arr = JSON.parse(xhr.response)
              //   var str = ``
              //   arr.msg.result.forEach(element => {
              //     str += `
              //   <li class="content-it">
              //   <a class="content-in" href="">
              //     <div class="content-pic">
              //       <div class="content-img">
              //         <img src="${element.sIMG}" alt="">
              //       </div>
              //       <div class="content-placehoder">
              //         <img src="./img/placeholder.webp" alt="">
              //       </div>
              //     </div>
              //     <h2 class="tit-content-article">${element.sTitle}</h2>
              //     <p class="content-tag">人才招聘</p>
              //     <div class="content-if">
              //       <p class="content-view content-view-count">
              //         <i class="i-view"></i>${element.iTotalPlay}
              //         <span class="content-like">
              //           <i class="i-like"></i>35
              //         </span>
              //       </p>
              //       <p class="content-date">
              //         <span class="content-author">${element.sAuthor} </span>${element.sIdxTime.substr(0, 10)}
              //       </p>
              //     </div>
              //   </a>
              // </li>
              //   `
              //   })
              //   document.querySelectorAll('.lis-content-show')[0].innerHTML += str

            }
          }
        }
        xhr.open('GET', 'http://localhost:8888/wmp/v3.1/?p0=117&p1=searchNewsKeywordsList&pagesize=12&order=sIdxTime&r0=cors&r1=NewsObj&type=iTag&id=6521&source=web_PC&page=' + pagenum)
        xhr.send()
      })
    }
    let pagenum = 1
    newPage(pagenum).then(result => {
      var arr = JSON.parse(result)
      var str = ``
      arr.msg.result.forEach(element => {
        str += `
                <li class="content-it">
                <a class="content-in" href="">
                  <div class="content-pic">
                    <div class="content-img">
                      <img src="${element.sIMG}" alt="">
                    </div>
                    <div class="content-placehoder">
                      <img src="./img/placeholder.webp" alt="">
                    </div>
                  </div>
                  <h2 class="tit-content-article">${element.sTitle}</h2>
                  <p class="content-tag">人才招聘</p>
                  <div class="content-if">
                    <p class="content-view content-view-count">
                      <i class="i-view"></i>${element.iTotalPlay}
                      <span class="content-like">
                        <i class="i-like"></i>35
                      </span>
                    </p>
                    <p class="content-date">
                      <span class="content-author">${element.sAuthor} </span>${element.sIdxTime.substr(0, 10)}
                    </p>
                  </div>
                </a>
              </li>
                `
      })
      document.querySelectorAll('.lis-content-show')[0].innerHTML += str

      // console.log(JSON.parse(result))
      // console.log(typeof result);
    }).catch(error => {
      console.log(error);
    })
  </script>
</body>

</html>